﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Advertise.aspx.cs" Inherits="www.Admin.Advertise" %>

<%@ Import Namespace="www.Controllers" %>

<%@ Register TagPrefix="cc1" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit, Version=1.0.10920.32919, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">


        function CheckAllEmp(checkbox) {
            var gridVwHeaderChckbox = document.getElementById("<%=grid_advertise.ClientID %>");
            for (i = 1; i < gridVwHeaderChckbox.rows.length; i++) {
                gridVwHeaderChckbox.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = checkbox.checked;
            }
        }


        function OnCurrencyValueKeyUp(input) {
            if (input.value.toString().length == 1 && input.value.toString() == '0')
                input.value = input.value.replace('0', '');

            var num = input.value.replace('.', '');
            num = input.value.replace(/\,/g, '');
            if ((!isNaN(num) || num == '-') && num != '-0') {
                if (num.indexOf('.') > -1) {
                    num = num.split('.');
                    num[0] = num[0].toString().split('').reverse().join('').replace(/(?=\d*\.?)(\d{3})/g, '$1,').split('').reverse().join('').replace(/^[\,]/, '');
                    if (num[1].length > 2) {
                        num[1] = num[1].substring(0, num[1].length - 1);
                    }
                    input.value = num[0] + '.' + num[1];
                }
                else {
                    input.value = num.toString().split('').reverse().join('').replace(/(?=\d*\.?)(\d{3})/g, '$1,').split('').reverse().join('').replace(/^[\,]/, '')
                };
            }
            else {
                input.value = input.value.substring(0, input.value.length - 1);
            }
            input.value = input.value.toString().replace(/\$|\ /g, '');
            input.value = input.value.toString().replace('.', '');
            input.value = input.value.toString().replace('-,', '-');

        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div class="title">
        QUẢN LÝ QUẢNG CÁO
    </div>
    <div class="clear">
    </div>
    <%--<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>--%>
    <div id="pnviews" runat="server">
        <div class="rows">
            <div class="ColLeft">
                Loại quảng cáo
            </div>
            <div class="ColRight">
                <asp:DropDownList ID="ddlgroups" runat="server" CssClass="combobox" AutoPostBack="True" OnSelectedIndexChanged="ddlgroups_SelectedIndexChanged"></asp:DropDownList>
            </div>
        </div>
        <div class="rows">
            <div class="ColLeft">
                Ngôn ngữ
            </div>
            <div class="ColRight">
                <asp:DropDownList ID="ddlLanguage1" runat="server" CssClass="combobox" AutoPostBack="True" OnSelectedIndexChanged="ddlLanguage_SelectedIndexChanged"></asp:DropDownList>
            </div>
        </div>
        <div class="clear">
        </div>
        <div class="frame ">
            <div class="table">
                <img src="../Design/Icon/icon/add.png" class="control" />
                <asp:LinkButton ID="lbtinsert1" runat="server" OnClick="lbtinsert_Click">Thêm mới</asp:LinkButton>
                <img src="../Design/Icon/icon/delete.png" class="control" />
                <asp:LinkButton ID="lbtdel1" runat="server" OnClick="lbtdel_Click">Xóa</asp:LinkButton>
                <img src="../Design/Icon/icon/refresh.png" class="control" />
                <asp:LinkButton ID="lbtrefresh1" runat="server" OnClick="lbtrefresh_Click">Làm Tươi</asp:LinkButton>
                <img src="../Design/Icon/icon/uplevel.png" class="control" />
                <a href="javascript:void(0);" onclick="window.history.go(-1);">Trở lại</a>
            </div>
            <div>
                <asp:GridView ID="grid_advertise" runat="server" AutoGenerateColumns="False" BackColor="White"
                    BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" Width="100%" AllowPaging="True"
                    PageSize="30" ShowHeaderWhenEmpty="True" OnPageIndexChanging="grid_advertise_PageIndexChanging" OnRowCommand="grid_advertise_RowCommand">
                    <Columns>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <input id="chkselectall" type="checkbox" runat="server" onclick="CheckAllEmp(this);" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:CheckBox ID="chkselect" runat="server" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField Visible="False">
                            <ItemTemplate>
                                <asp:Label ID="lblId" runat="server" Text='<%#Eval("Id") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Tên
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%#Eval("Name") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Hình ảnh
                            </HeaderTemplate>
                            <ItemTemplate>
                                <img id="imgadvertise" src='../<%#Eval("Image") %>' height="70" width="80" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Liên kết
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%#Eval("Link") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Thứ tự ƯT
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%#Eval("Ord") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Trạng thái
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%# Utilities.Active(Convert.ToInt32(Eval("Active"))) %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Thao tác
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:ImageButton ID="ibtedit" runat="server" ToolTip='Sửa' CssClass="business" CommandName="cmd_edit"
                                    CommandArgument='<%#Eval("Id") %>' ImageUrl="../Design/Icon/icon/edit.png" />
                                <asp:ImageButton ID="ibtdel" runat="server" ToolTip='Xóa' CssClass="business" CommandName="cmd_delete"
                                    CommandArgument='<%#Eval("Id") %>' ImageUrl="../Design/Icon/icon/delete.png" />
                                <asp:ImageButton ID="ibtactive" runat="server" ToolTip='<%#Utilities.TooltipActive(Convert.ToInt32(Eval("active"))) %>'
                                    CommandArgument='<%#Eval("Id") %>' CommandName="cmd_active" CssClass="business" ImageUrl="../Design/Icon/icon/stop1.png" />
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="14%"></HeaderStyle>
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                    <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
                    <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                    <RowStyle BackColor="White" ForeColor="#003399" />
                    <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                    <SortedAscendingCellStyle BackColor="#EDF6F6" />
                    <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
                    <SortedDescendingCellStyle BackColor="#D6DFDF" />
                    <SortedDescendingHeaderStyle BackColor="#002876" />
                </asp:GridView>
            </div>
            <div class="table">
                <img src="../Design/Icon/icon/add.png" class="control" />
                <asp:LinkButton ID="lbtinsert2" runat="server" OnClick="lbtinsert_Click">Thêm mới</asp:LinkButton>
                <img src="../Design/Icon/icon/delete.png" class="control" />
                <asp:LinkButton ID="lbtdel2" runat="server" OnClick="lbtdel_Click">Xóa</asp:LinkButton>
                <img src="../Design/Icon/icon/refresh.png" class="control" />
                <asp:LinkButton ID="lbtrefress2" runat="server" OnClick="lbtrefresh_Click">Làm tươi</asp:LinkButton>
                <img src="../Design/Icon/icon/uplevel.png" class="control" />
                <a href="javascript:void(0);" onclick="window.history.go(-1);">Trở lại</a>
            </div>
        </div>
    </div>
    <div id="pncontrols" runat="server" visible="False">
       <%-- <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>--%>
                <div class="table">
                    <img src="../Design/Icon/icon/page_save.png" class="control" />
                    <asp:LinkButton ID="lbtsave1" runat="server" OnClick="lbtsave_Click">Lưu</asp:LinkButton>
                    <img src="../Design/Icon/icon/moi.gif" class="control" />
                    <asp:LinkButton ID="lbtdonew1" runat="server" OnClick="lbtdonew_Click">Làm mới</asp:LinkButton>
                    <img src="../Design/Icon/icon/back.png" class="control" />
                    <asp:LinkButton ID="lbtback1" runat="server" OnClick="lbtback_Click">Trở lại</asp:LinkButton>
                </div>
                <div class="frame">
                    <div class="rows">
                        <div class="ColLeft">
                            Ngôn ngữ
                        </div>
                        <div class="ColRight">
                            <select id="ddlLanguage" runat="server" class="combobox"></select>
                        </div>
                    </div>
                    <div class="rows">
                        <div class="ColLeft">
                            Tên
                        </div>
                        <div class="ColRight">
                            <input id="txtname" type="text" runat="server" class="textbox" />
                        </div>
                    </div>
                    <div class="rows">
                        <div class="ColLeft">
                            Loại
                        </div>
                        <div class="ColRight">
                            <select id="ddltype_advertise" runat="server" class="combobox">
                            </select>
                        </div>
                    </div>
                    <div class="rows">
                        <div class="ColLeft">
                            Hình ảnh
                        </div>
                        <div class="ColRight">
                            <input id="fuadvertise" type="file" class="fileupload" runat="server" />
                            <%-- <asp:FileUpload ID="fuadvertise" CssClass="fileupload" runat="server" />--%>
                        </div>
                    </div>
                    <div class="rows">
                        <div class="ColLeft">
                            Liên kết
                        </div>
                        <div class="ColRight">
                            <input id="txtlink" type="text" runat="server" class="textbox" />
                        </div>
                    </div>
                    <div class="rows">
                        <div class="ColLeft">
                            Kiểu liên kết
                        </div>

                        <div class="ColRight">
                            <select id="ddltype_link" class="combobox" runat="server"></select>
                        </div>
                    </div>
                    <div class="rows">
                        <div class="ColLeft">
                            Giá
                        </div>
                        <div class="ColRight">
                            <input id="txtprice" type="text" runat="server" class="textbox" onkeyup="javascript:OnCurrencyValueKeyUp(this);" />
                        </div>
                    </div>
                    <div class="rows">
                        <div class="ColLeft">
                            Ngày bắt đầu
                        </div>
                        <div class="ColRight">
                            <%--<input id="txtDateBegin" type="text" runat="server" class="datefield" />--%>
                            <asp:TextBox ID="txtDateBegin" CssClass="datefield" runat="server" ></asp:TextBox>
                            <cc1:CalendarExtender ID="CalendarExtender4" CssClass="datepopup" TargetControlID="txtDateBegin" Format="MM/dd/yyyy" runat="server" PopupPosition="TopLeft"></cc1:CalendarExtender>
                        </div>
                    </div>
                    <div class="rows">
                        <div class="ColLeft">
                            Ngày kết thúc
                        </div>
                        <div class="ColRight">
                            <%--<input id="txtDateEnd" type="text" runat="server" class="datefield" />--%>
                            <asp:TextBox ID="txtDateEnd" CssClass="datefield" runat="server" ></asp:TextBox>
                            <cc1:CalendarExtender ID="CalendarExtender3" CssClass="datepopup" TargetControlID="txtDateEnd" Format="MM/dd/yyyy" runat="server" PopupPosition="TopLeft"></cc1:CalendarExtender>
                        </div>
                    </div>
                    <div class="textarial">
                        <div class="ColLeft">
                            Mô tả
                        </div>
                        <div class="ColRight">
                            <textarea id="txtdecription" class="textarea2" runat="server" />
                        </div>
                    </div>
                    <div class="rows">
                        <div class="ColLeft">
                            Thứ tự ưu tiên
                        </div>
                        <div class="ColRight">
                            <input id="txtord" type="text" class="textbox" runat="server" />
                        </div>
                    </div>
                    <div class="rows">
                        <div class="ColLeft">
                            Trạng thái
                        </div>
                        <div class="ColRight">
                            <input id="chkactive" type="checkbox" runat="server" class="checkbox" />
                        </div>
                    </div>
                </div>
                <div class="table">
                    <img src="../Design/Icon/icon/page_save.png" class="control" />
                    <asp:LinkButton ID="lbtsave2" runat="server" OnClick="lbtsave_Click">Lưu</asp:LinkButton><img src="../Design/Icon/icon/moi.gif" class="control" />
                    <asp:LinkButton ID="lbtdonew2" runat="server" OnClick="lbtdonew_Click">Làm mới</asp:LinkButton><img src="../Design/Icon/icon/back.png" class="control" />
                    <asp:LinkButton ID="lbtback2" runat="server" OnClick="lbtback_Click">Trở lại</asp:LinkButton>
                </div>
          <%--  </ContentTemplate>
        </asp:UpdatePanel>--%>
    </div>

</asp:Content>
